package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqBargainPriceCollect;
import com.ruoyi.hqfinance.domain.vo.HqBargainPriceCollectVo;
import com.ruoyi.hqfinance.mapper.HqBargainPriceCollectMapper;
import com.ruoyi.hqfinance.service.HqBargainPriceCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class HqBargainPriceCollectServiceImpl implements HqBargainPriceCollectService {
    @Autowired
    private HqBargainPriceCollectMapper hqBargainPriceCollectMapper;

    @Override
    public List<HqBargainPriceCollect> bargainPriceCollect(HqBargainPriceCollectVo hqBargainPriceCollectVo) {
        PageHelper.startPage(hqBargainPriceCollectVo.getPageDate());
        List<HqBargainPriceCollect> bargainPriceCollects = hqBargainPriceCollectMapper.bargainPriceCollect(hqBargainPriceCollectVo);
        assert bargainPriceCollects != null;
        for (HqBargainPriceCollect hqBargainPriceCollect : bargainPriceCollects) {
            if (hqBargainPriceCollectVo.getCollectType() == 2) {
                hqBargainPriceCollect.setDate(hqBargainPriceCollectVo.getStartTime() + "至" +hqBargainPriceCollectVo.getEndTime());
            }
            if (hqBargainPriceCollectVo.getDisplayLevel() == 2){
                hqBargainPriceCollect.setNetworkCode("124000");
                hqBargainPriceCollect.setName("辽宁盘锦公司");
            }
        }
        return bargainPriceCollects;
    }
}
